package com.cht.commonUtil.requirements;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cht.commonUtil.webInit.SP;
import com.cht.commonUtil.widgets.Widgets;


public class IsReqDuplicate extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		request.setCharacterEncoding( SP.UIcodeSet );
		response.setContentType("application/text");
		response.setCharacterEncoding( SP.UIcodeSet );
		
		String reqSID = request.getParameter("reqSID");
		String reqDesc = request.getParameter("reqDesc");
		
		int res=0;
		
		try {
			res = Widgets.isReqExisted(reqSID, reqDesc);
		} catch (Exception e) {
			Widgets.errLog(e);
		}
		
		response.getWriter().write( String.valueOf( res ) );
	
	}

}
